<{extends file="<{$tempdir}>/public/wxsite.html"}>
<{block name=extendcss}>
<link rel="stylesheet"  href="<{$siteurl}>/templates/<{$tempdir}>/public/wxsite/css/editaddress.css">

<{/block}>
<{block name=extendjs}>
<script src="<{$siteurl}>/templates/<{$tempdir}>/public/wxsite/js/template.min.js"></script>
<{/block}>
<{block name=myScrolljs}>
<script>
    var myScroll;
    function loaded() {
        myScroll = new iScroll('wrapper', {
            useTransform: false,
            onBeforeScrollStart: function (e) {
                var target = e.target;
                while (target.nodeType != 1) target = target.parentNode;

                if (target.tagName != 'SELECT' && target.tagName != 'INPUT' && target.tagName != 'TEXTAREA')
                    e.preventDefault();
            }
        });
    }
    document.addEventListener('touchmove', function (e) { e.preventDefault(); }, false);
    document.addEventListener('DOMContentLoaded', function () { setTimeout(loaded, 200); }, false);
</script>
<{/block}>
<{block name=sitetitle}><{$sitename}><{/block}>
<{block name=hearnav}>
<div class="toptitCon">
    <div class="toptitBox">
        <div class="toptitL"><i></i></div>
        <div class="toptitC"><h3>绑定手机号</h3></div>
    </div>
</div>
<{/block}>
<{block name=blockcontent}>
<div id="wrapper" style="top:40px;">
    <div id="scroller">

        <div class="sendcode">
            <ul>
                <li><input type="text" placeholder="请输入要绑定的手机号" id="phone" name="phone" value="" class="sendcodeinp1"></li>
                <{if $regestercode==1}>
                <li><input type="text" placeholder="请输入验证码" id="pwdyzm" name="pwdyzm" class="sendcodeinp2" style="width:64%;float: left;">
                    <input type="button"   onclick="clickyanzheng();"   time="0" id="dosendbtn"  value="获取验证码"  style="float: left;" class="sendcodeinp3">
                </li>
                <{/if}>
				<div style="clear:both;"></div>
            </ul>
        </div>
        <div class="intexchabutt"><input type="button" value="确认绑定" id="nextzhpwd" onclick="nextzhpwd();" datauid="0" class="intexbg1"></div>
        <div style="height:10px;"></div>
    </div>
</div>
<script>

    function nextzhpwd(){
        var datauid = $("#nextzhpwd").attr('datauid');
        $('#loading').show();
        url = siteurl+'/index.php?ctrl=wxsite&action=surebinding&datatype=json&random=@random@';
        url = url.replace('@random@', 1+Math.round(Math.random()*1000));
        $.ajax({         //script定义
            url: url.replace('@random@', 1+Math.round(Math.random()*1000)),
            dataType: "json",
            async:true,
            data:{'phone':$("#phone").val(),'pwdyzm':$("#pwdyzm").val(),'datauid':datauid},
            success:function(content) {
                if(content.error ==  false){
                    Tmsg('绑定成功！');
                    $('.closegb').live("click", function() {
                        $('.popup').slideToggle('slow',function(){$('#mask').remove();$('.popup').remove();});
                        window.location.href=  siteurl+'/index.php?ctrl=wxsite&action=myaccount' ;
                    });
                }else{
                    Tmsg(content.msg);
                }
                $('#loading').toggle();

            },
            error:function(){
                $('#loading').toggle();
            }
        });
    }
</script>

<script>
    function noshow(msg){
        Tmsg(msg);
    }
    //获取手机验证码
    function clickyanzheng(){
        var tempurl = siteurl+'/index.php?ctrl=wxsite&action=bindingphone&random=@random@&phone=@phone@';
        tempurl = tempurl.replace('@random@', 1+Math.round(Math.random()*1000)).replace('@phone@',$('#phone').val());
        $.getScript(tempurl);
    }
    function showsend(phone,time,uid){
        $("#nextzhpwd").attr('datauid',uid);
        $('input[name="phone"]').val(phone);
        $('#dosendbtn').attr('time',time);
        setTimeout("btntime();",1000);
    }
    function  btntime(){
        var nowtime = Number($('#dosendbtn').attr('time'));
        if(nowtime > 0){
            $('#dosendbtn').attr('disabled',true);
            $('#dosendbtn').addClass('seinpbg1');
            var c = Number(nowtime)-1;
            $('#dosendbtn').attr('time',c);
            var  mx = 120-(120 - Number(c));
            $('#dosendbtn').attr('value','剩余'+mx+'秒');
            setTimeout("btntime();",1000);
        }else{
            $('#dosendbtn').attr('disabled',false);
            $('#dosendbtn').removeClass('seinpbg1');
            $('#dosendbtn').attr('value','重新获取');
        }

    }




</script>
<{/block}>